#include <iostream>
#include <vector>
#include <queue>
#include "treenode.h"
#include "common.h"
using namespace std;

class Solution {
public:
    vector<int> PrintFromTopToBottom(TreeNode* root) {
        vector<int> result;
        if (root == nullptr) {
            return result;
        }
        queue<TreeNode*> q;
        q.push(root);
        while (!q.empty()) {
            TreeNode *current = q.front();
            q.pop();
            result.push_back(current->val);
            if (current->left != nullptr) {
                q.push(current->left);
            }
            if (current->right != nullptr) {
                q.push(current->right);
            }
        }
        return result;
    }
};

int main() {
    cout << Solution().PrintFromTopToBottom(new TreeNode(1, new TreeNode(2), new TreeNode(3))) << endl;
    return 0;
}